<!DOCTYPE html>
<html>
<head>
<!-- 	<link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/font-awesome.4.6.0.css"> -->

  	<link rel="stylesheet" href="../../static/css/font-awesome.4.6.0.css">

	<link href="../../static/css/froala_editor.min.css" rel="stylesheet" type="text/css">


    <style>
        body {
            text-align: center;
            background-color: #d0c0c0;
        }

        section {
            width: 80%;
            margin: auto;
            text-align: left;
        }
    </style>
</head>

<body>

  <section id="editor">
      <div id='edit' style="margin-top: 30px;">


			{% block content %}
          
			{% endblock %}

          
      </div>
  </section>

  <br/>
    <br/>
  <div id="number" style="color:blue;size:"200px">问题优先级请选择：<select  style="color: #000;" id="num"></select></div>
  <br/>
    <br/>

  <div style="text-align: center;"><button type="button" id="show_questions" style="background-color: #009688;border: none;color: #fff; width:80px;height:38px">修改并提交</button>&emsp;  &emsp; <button type="button" id="turnback" style="background-color: #009688;border: none;color: #fff; width:80px;height:38px">返回</button></div>

  
  
   <script src="../../static/js/jquery-1.10.2.js"></script>
  <script src="../../static/js/froala_editor.min.js"></script>
  <!--[if lt IE 9]>
    <script src="../js/froala_editor_ie8.min.js"></script>
  <![endif]-->
  <script src="../../static/js/plugins/tables.min.js"></script>
  <script src="../../static/js/plugins/lists.min.js"></script>
  <script src="../../static/js/plugins/colors.min.js"></script>
  <script src="../../static/js/plugins/media_manager.min.js"></script>
  <script src="../../static/js/plugins/font_family.min.js"></script>
  <script src="../../static/js/plugins/font_size.min.js"></script>
  <script src="../../static/js/plugins/block_styles.min.js"></script>
  <script src="../../static/js/plugins/video.min.js"></script>

  <script>
	$(function(){
	  $('#edit').editable({inlineMode: false, alwaysBlank: true})
	});
	
	function GetQueryString(name) {
		var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
		var r = window.location.search.substr(1).match(reg);
		if(r!=null)return  unescape(r[2]); return null;
	}
	
	
	for (var i=0;i<100;i++)
	{
		$("#num").append('<option style="color: #000;" value ="'+i+'">'+i+'</option>');
	}
	
	$("#num option[value='{% block priority %}{% endblock %}']").attr("selected","selected");
	
	$("#show_questions").on("click",function(){
		
		var news_html = $(".froala-element").html()
		var priority = $("#num option:selected").html();	
		var id = $("#num option:selected").html();	
		var id = GetQueryString("id");
		
		params = {
			"news_html":news_html,
			"priority":priority,
			"id":id,
		}
		
		$.ajax({			
			url:"/app/questions/modify",
			type:"POST",
            data:JSON.stringify(params),
            contentType:'application/json',
			success:function(res){
                if(res.status == 0){
					alert(res.msg);
                    location.href="/app/show/questions_list";
                }else {
                    alert(res.msg);
                }
            }
		
		});
	})
	
	 $("#turnback").on("click",function(){
    
      location.href="/app/show/questions_list";
    });


	{% block script %}
	
	{% endblock %}
  </script>
</body>


</html>
